<template>
  <el-form-item v-if="!content.keywords.length" label="关键词">
    <span style="color: red;font-style: italic;font-weight: bold;margin: auto;font-size: 16px">未选择关键词</span>
  </el-form-item>
  <el-form-item label="关键词" v-for="(keyword,i) in content.keywords" :key="i">
    <span style="margin: auto">{{ keyword }}</span>
    <el-button @click="delContentKeyword(i)" style="margin-left: auto">删除关键词</el-button>
  </el-form-item>
  <add-content-keyword-component v-model="content"/>
</template>

<script setup>
import AddContentKeywordComponent from "@/components/add/document/keyword/bak/AddContentKeywordComponent.vue";
import {defineModel} from "vue";

const content = defineModel()
const delContentKeyword = (j) => {
  const len = content.value.keywords.length
  if (0 <= j && j < len && confirm('确定要删除关键词' + content.value.keywords[j].name + '?')) {
    content.value.keywords.splice(j, 1);
  }
}

</script>

<style scoped>

</style>